$OpenBSD: patch-ext_mcrypt_mcrypt_c,v 1.3 2016/12/19 20:35:09 martijn Exp $

mcrypt IV creation. no /dev/{u,}random? yes, it is using the last hunk.

--- ext/mcrypt/mcrypt.c.orig.port	Wed Nov  9 02:22:57 2016
+++ ext/mcrypt/mcrypt.c	Thu Dec  8 10:55:26 2016
@@ -1445,7 +1445,10 @@ PHP_FUNCTION(mcrypt_create_iv)
 	}
 
 	iv = ecalloc(size + 1, 1);
-
+#if defined(__OpenBSD__)
+	arc4random_buf(iv, (size_t) size);
+	n = size;
+#else
 	if (source == RANDOM || source == URANDOM) {
 #if PHP_WIN32
 		/* random/urandom equivalent on Windows */
@@ -1490,6 +1493,7 @@ PHP_FUNCTION(mcrypt_create_iv)
 			iv[--size] = (char) (255.0 * php_rand(TSRMLS_C) / RAND_MAX);
 		}
 	}
+#endif /* openbsd */
 	RETURN_STRINGL(iv, n, 0);
 }
 /* }}} */
